# -*- coding: UTF-8 -*-
"""
@Project ：swift-forge-engine 
@File    ：token
@IDE     ：PyCharm 
@Author  ：Tony
@Date    ：2025/2/20 15:17 
@Des     ：
"""
from datetime import datetime
from typing import Optional

from App.app.admin.schemas.sys_user_schema import GetSysUseInfoNoRoleDetail
from App.common.schema import SchemaBase
from App.utils.enums import StatusType


class GetSwaggerToken(SchemaBase):
    access_token: str
    token_type: str = 'Bearer'
    user: GetSysUseInfoNoRoleDetail


class AccessTokenBase(SchemaBase):
    access_token: str
    refresh_token: Optional[str] = None
    access_token_expire_time: datetime
    refresh_token_expire_time: Optional[datetime] = None
    session_uuid: str


class GetNewToken(AccessTokenBase):
    pass


class GetLoginToken(AccessTokenBase):
    user: GetSysUseInfoNoRoleDetail


class KickOutToken(SchemaBase):
    session_uuid: str


class GetTokenDetail(SchemaBase):
    id: int
    session_uuid: str
    username: str
    nickname: str
    ip: str
    os: str
    browser: str
    device: str
    status: StatusType
    last_login_time: str
    expire_time: datetime


class ReqRefreshToken(SchemaBase):
    refresh_token: Optional[str] = None

